<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Site extends CI_Controller {

	public function solution($c=NULL) {
        $page_name = "solution";
        if($c != NULL) $page_name .= "_". $c;
        $this->load->view("website/$page_name.php"); 
	}

    public function demos() {
        $this->load->view('website/demos.php'); 
    }
    
    public function aboutus() {
        $this->load->view('website/aboutus.php'); 
    }
    
    public function joinus($c=NULL) {
        $page_name = "joinus";
        if($c != NULL) $page_name .= "_". $c;
        $this->load->view("website/$page_name.php"); 
    }
       
    public function feedback() {
        $page=1;
        if(isset($_GET['page'])) $page = $_GET['page'];
        $page_size = 5;
        $start_index = ($page-1)*$page_size;
        $total_rows = $this->db->query('select count(0) as cnt from visa_feedback')->row()->cnt;       
        $this->load->library('pagelinks');
        $this->pagelinks->setRecordCount($total_rows);          
        $this->pagelinks->setPageSize($page_size); 
        $result = $this->db->query("select * from visa_feedback order by id desc limit $start_index, $page_size")->result();
        $data = array( 
            'list' => $result,
            'page_links' => $this->pagelinks->show(true)
        );
        $this->load->view('website/feedback.php', $data); 
    } 
    
    public function del_feedback($id="-1") {
        $this->db->simple_query("delete from visa_feedback where id=$id");
        redirect("/site/feedback");
    }   
    
    public function partner() {
        $this->load->view('website/partner.php'); 
    }     
    
    public function post_feedback() {
        $this->db->insert("visa_feedback", $_POST);
        echo "ok";
    }
  
    public function post_joinus() {
        $this->db->insert("visa_joinus", $_POST);
        echo "ok";
    }        
}